var path = require('path')
var src = __dirname + "/src";


var webpack = require('webpack');
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin("vender", "vendor.bundle.js");
var HtmlWebpackPlugin = require('html-webpack-plugin');
var htmlPlugin = new HtmlWebpackPlugin({
    template:path.join(src, "index.html"), modify:true,inject:'body'
});

module.exports={
    target:'web',
    entry:{
        vendor:['jquery', 'page'],
        entry:path.join(src, "entry.coffee")
    },
    resolve:{
        root:src
    },
    output:{
        path:"./dist",
        filename:"[name].js",
        publicPath:""
    },
    module:{
        loaders:[
            {test: /\.css$/, loader: "style!css"},
            {test: /\.scss$/, loader: "style!css!sass"},
            {test: /\.coffee$/, loader: "coffee"},
            {test: /\.jade/, loader: "jade"},
            {
                test: /\.jpg$/,
                loader: "file"
            }
        ]
    },
    plugins: [commonsPlugin, htmlPlugin]
}